package cn.com.jit.hl.demo.pattern.factory.simple;

/**
 * 简单工厂
 * @author HL
 * @date 2020/9/10 14:23
 */
public class FruitFactory {
    public Fruit createFruit(String type){
        if(type.equals("apple")){
            return new Apple();
        }else if(type.equals("pear")){
            return new Pear();
        }else {
            return null;
        }
    }
}
